<template>
	<div id="tmpl">
		<div class="title">
			<h4>{{info.title}}</h4>
			<p>{{info.add_time|datefmt("YYYY-MM-DD HH:mm:ss")}}</p>
			<hr/>
			<div id="content" v-html="info.content"></div>
		</div>
		<!-- 评论 -->
		<comment :id="id"></comment>
	</div>
</template>
<script>
import comment from '../subcom/comment.vue';
import {Toast} from 'mint-ui';
import common from '../../kits/common.js';
	export default{
		components:{
			comment //把评论的vue引入使用
		},
		data(){
			return{
				id:0,
				info:{},
			}
			
		},
		created(){this.id=this.$route.params.id;
			this.getnewsinfo(this.id)
			},
		methods:{
			getnewsinfo(id){				
				var url=common.apidomain+"/api/getnew/"+id;
				this.$http.get(url).then(function(response){
					var data = response.body;
					if (data.status != 0) {
						Toast(data.message);
						return;
					}
					this.info=data.message[0];
				})
			}
		}
	}
</script>
<style scoped>
	.title h4{
		margin-top: 3px;
		color:#0049ff;
	}
	.title p{
		color:rgba(0,0,0,.4);
	}
	.title #content{
		margin-top: 5px;
	} 

</style>